from nicegui import ui
from pathlib import Path
import inspect


ng_path = Path(inspect.getfile(ui.aggrid)).parent
component_js = ng_path / "./aggrid.js"


libs = [
    Path(__file__).parent / "ag-grid-community.min.js",
]


class epAggrid(ui.aggrid, component=component_js, dependencies=libs):  # type: ignore
    pass


ui.add_body_html(
    r"""
<script type="module">
    import "ag-grid-community";
    const licenseKey = "your_license_key_here";
    agGrid.LicenseManager.setLicenseKey(licenseKey);   
</script>
""",
    shared=True,
)
